package org.MyApi.API;

import org.MyApi.Classes.OfferProduct;
import org.MyApi.Classes.ServiceAccount;
import org.apache.cxf.jaxrs.model.wadl.Description;
import org.apache.cxf.jaxrs.model.wadl.Descriptions;
import org.apache.cxf.jaxrs.model.wadl.DocTarget;
import org.iodocs.*;

import javax.ws.rs.*;

/**
 * User: Anjana D. Kulasinghe
 * Date: 9/26/13
 */

@Path("/query")
public class MyTestApi {


    @POST
    @Path("/resource")
    @IoDocsName("queryName")
    @Descriptions({@Description(value = "Run a query", target = DocTarget.METHOD)})

    public void SamplePostAPI(
            @QueryParam("My Test Api Parameter Integer")
            @Description("My Test Api Parameter Integer Description")
            @IoDocsRequired
            @IoDocsDefaultInteger(2)
            int integerParameter,
            @QueryParam("My Test Api Parameter String")
            @Description("My Test Api Parameter String Description")
            @IoDocsRequired
            @IoDocsDefaultString("Test")
            String stringParameter,
            @QueryParam("My Test Api Parameter Boolean")
            @Description("My Test Api Parameter Boolean Description")
            @IoDocsRequired
            @IoDocsDefaultBoolean(true)
            boolean booleanParameter,
            @QueryParam("My Ignore Test Api Parameter")
            @IoDocsIgnore
            int ignoreParameter,
            @QueryParam("My Test Api Simple Object Parameter")
            @Description("My Test Api Simple Object Parameter Description")
            @IoDocsRequired
            @IoDocsDefaultString("{\n  \"product\": null,\n  \"defaultQuantity\": null\n}:_:")
            OfferProduct simpleObject,
            @QueryParam("My Test Api Complex Object Parameter")
            @Description("My Test Api Complex Object Parameter Description")
            @IoDocsRequired
            @IoDocsDefaultString("{\n  \"ServiceConfiguration\": {\n    \"Id\": null,\n    \"Service\": " +
                    "{\n      \"Id\": null,\n      \"ServiceProvider\": {\n        \"Id\": null\n      }," +
                    "\n      \"ServiceCode\": null,\n      \"ServiceProviderCollection\": null\n    },\n    " +
                    "\"ServiceList\": null\n  },\n  \"Service\": {\n    \"Id\": null,\n    " +
                    "\"ServiceProvider\": {\n      \"Id\": null\n    },\n    " +
                    "\"ServiceCode\": null,\n    \"ServiceProviderCollection\": null\n  },\n  \"Id\": null," +
                    "\n  \"ClientId\": null,\n  \"ClientReferenceId\": null,\n  \"SpServiceAccountId\": null\n}" +
                    ":_:")
            ServiceAccount complexObject) {


    }

    @GET
    public int SampleGetAPI(
            @HeaderParam("My Get Classes Parameter Name")
            @Description("My Get Classes Parameter Description")
            @IoDocsRequired
            @IoDocsDefaultInteger(2)
            int getParameter) {
        return getParameter * 10;
    }
}
